home *** CD-ROM | disk | FTP | other *** search
- *******************************************************************************
- * All ugly code down here is generated by Designer... *
- *******************************************************************************
-
- NewMenu0SubItemNumber:
- dc.w 0
- NewMenu0ItemNumber:
- dc.w 0
- NewMenu0Item:
- dc.l 0
-
-
- ProcessMenuIDCMPNewMenu0: ; MenuNumber in d0, Code field of intuimessage.
- movem.l d1-d4/a0-a4/a6,-(sp)
-
- .Menuloop
- move.l #0,d5
- move.w d0,d5
- move.l d5,d0
- movea.l NewMenu0,a0
- movea.l _IntuitionBase,a6
- jsr _LVOItemAddress(a6)
- move.l d0,NewMenu0Item
- tst.l d0
- beq .D
- move.l d5,d0
- lsr #5,d0
- lsr #6,d0
- and.w #31,d0 ; SubItemNumber in d0
- move.w d0,NewMenu0SubItemNumber
- move.w d5,d0
- lsr #5,d0
- and.w #63,d0 ; ItemNumber in d0
- move.w d0,NewMenu0ItemNumber
- move.w d5,d0
- and.w #31,d0 ; MenuNumber in d0
-
- cmp.w #31,d0
- bne .No0
- jmp .Done
- .No0
- cmp.w #NewMenu_Menu0X,d0
- bne .NoOption
-
- move.w NewMenu0ItemNumber,d0
- cmp.w #63,d0
- bne .NoOption
- ; No Item selected
- jmp .Done
- .NoOption
- cmp.w #NewMenu_Menu0_Item0X,d0
- bne .NoAboutMenu
- Jsr About_Diskled
- bra.w .Done
- .NoAboutMenu
-
- cmp.w #NewMenu_Menu0_Item1X,d0
- bne .NoQuit
- Move.l #1,Done ; QUIT
- bra.w .Done
- bra .D
- .NoQuit
-
- .Done
- move.l NewMenu0Item,a0
- move.w 32(a0),d0
- jmp .MenuLoop
-
- .D
- movem.l (sp)+,d1-d4/a0-a4/a6
- rts
-
-
- NewMenu0Name0:
- dc.b 'DiskLED',0
-
- NewMenu0Name1:
- dc.b 'About...',0
-
- NewMenu0Comm1:
- dc.b 'A',0
-
- NewMenu0Name2:
- dc.b 'Quit',0
-
- NewMenu0Comm2:
- dc.b 'Q',0
-
- cnop 0,2
-
- XDEF NewMenu0NewMenu0
-
- NewMenu0NewMenu0:
- dc.b 1,0 ; Menu Title
- dc.l NewMenu0Name0 ; Title String
- dc.l 0 ; CommKey (Not Used)
- dc.w 0 ; Title Flags
- dc.l 0,0 ; MX, User Field
-
- NewMenu0NewMenu1:
- dc.b 2,0 ; Menu Item
- dc.l NewMenu0Name1 ; Item String
- dc.l NewMenu0Comm1 ; Item Commkey
- dc.w 0 ; Item Flags
- dc.l 0 ; Item Mutual Exclude
- dc.l 0 ; User Field
-
- NewMenu0NewMenu2:
- dc.b 2,0 ; Menu Item
- dc.l NewMenu0Name2 ; Item String
- dc.l NewMenu0Comm2 ; Item Commkey
- dc.w 0 ; Item Flags
- dc.l 0 ; Item Mutual Exclude
- dc.l 0 ; User Field
-
- dc.b 0,0 ; End new menu array
- dc.l 0,0
- dc.w 0
- dc.l 0,0
-
- XDEF NewMenu0
- NewMenu0: ; Menu Pointer
- dc.l 0
-
- NewMenu0VI: ; Menu Visual Info
- dc.l 1
-
- NewMenu0LT: ; Tags for layout menu
- dc.l $80080043,1 ; V39 newmenu
- dc.l 0 ; Tag_Done
- Even
- BevelTags:
- Dc.w $8008
- B1t Dc.w $35; $0035
- Dc.l 1 ; GTBB_Recessed,True
- Dc.l $80080034,0 ; GT_VisualInfo
- Dc.l 0 ; TAG_DONE
- CNop 0,2
-
- BevelTags2:
- Dc.w $8008
- B2t Dc.w $0035
- Dc.l 1 ; GTBB_Recessed,True
- Dc.l $80080034,0 ; GT_VisualInfo
- Dc.l 0 ; TAG_DONE
- CNop 0,2
-
- BevelTags3:
- Dc.w $8008
- B3t Dc.w $0035
- Dc.l 1 ; GTBB_Recessed,True
- Dc.l $80080034,0 ; GT_VisualInfo
- Dc.l 0 ; TAG_DONE
- CNop 0,2
-
-
-
-
- XDEF Win0
- XDEF Win0GList
- XDEF Win0VisualInfo
- XDEF Win0DrawInfo
-
- Win0:
- dc.l 0
- Win0VisualInfo:
- dc.l 0
- Win0DrawInfo:
- dc.l 0
-
- Win0MsgPort:
- dc.l 0
- Win0WindowTitle:
- dc.b 'LED',0
- cnop 0,2
-
- Win0BufNewGad:
- dc.w 0,0,0,0
- dc.l 0,0
- dc.w 0
- dc.l 0,0,0
- Win0_Gad0TX: ; Text for Text_Kind gadget
- dc.b 'H. DISK',0
- cnop 0,2
- Win0_Gad1TX: ; Text for Text_Kind gadget
- dc.b 'F. DISK',0
- cnop 0,2
- Win0_Gad2TX: ; Text for Text_Kind gadget
- dc.b 'POWER',0
- cnop 0,2
- GD_Win0_Gad0 EQU 0
- Win0_Gad0 EQU 0
- GD_Win0_Gad1 EQU 1
- Win0_Gad1 EQU 1
- GD_Win0_Gad2 EQU 2
- Win0_Gad2 EQU 2
-
- GDX_Win0_Gad0 EQU 0
- GDX_Win0_Gad1 EQU 1
- GDX_Win0_Gad2 EQU 2
-
- Win0GTags:
- dc.l $8008000B,Win0_Gad0TX ; GTTX_Text
- dc.l 0 ; TAG_DONE
- dc.l $8008000B,Win0_Gad1TX ; GTTX_Text
- dc.l 0 ; TAG_DONE
- dc.l $8008000B,Win0_Gad2TX ; GTTX_Text
- dc.l 0 ; TAG_DONE
-
- Win0GTypes:
- dc.w 13 ; Text
- dc.w 13 ; Text
- dc.w 13 ; Text
-
- Win0NGad:
- dc.w 4,1,59,12
- dc.l Win0_Gad0Text,topaz800
- dc.w GD_Win0_Gad0
- dc.l 1,0,0
- dc.w 4,12,61,12
- dc.l Win0_Gad1Text,topaz800
- dc.w GD_Win0_Gad1
- dc.l 1,0,0
- dc.w 3,23,61,12
- dc.l Win0_Gad2Text,topaz800
- dc.w GD_Win0_Gad2
- dc.l 1,0,0
-
- Win0_Gad0Text:
- dc.b '',0
-
- Win0_Gad1Text:
- dc.b '',0
-
- Win0_Gad2Text:
- dc.b '',0
-
- cnop 0,2
-
- Win0ZoomInfo:
- dc.w 0,11,120,11 ; Initial zoom size
-
-
- XDEF Win0Gadgets
- Win0Gadgets:
- ds.l 3
- Win0Cla: ; Private Class Name Container
- dc.l 0
- Win0PrevGadget: ; Previous Gadget Container
- dc.l 0
- Win0QuickTags: ; Tags for SetAttrs and SetGadgetAttrs
- dc.l 0,0,0
- cnop 0,2
-
- XDEF Win0Offx
- XDEF Win0Offy
- Win0Offx: ; Window X offset
- dc.w 0
- Win0Offy: ; Window Y Offset
- dc.w 0
-
- Win0Tags:
- dc.l $80000064,533 ; WA_Left
- dc.l $80000065,11 ; WA_Top
- dc.l $80000066
- Win0Width:
- dc.l 116
- dc.l $80000067
- Win0Height:
- dc.l 37 ; WA_Height
- dc.l $8000006E ; WA_Title
- Win0WT:
- dc.l Win0WindowTitle ; Window Title
- dc.l $80000072,120 ; WA_MinWidth
- dc.l $80000073,48 ; WA_MinHeight
- dc.l $80000074,120 ; WA_MaxWidth
- dc.l $80000075,48 ; WA_MaxHeight
- dc.l $80000082,1 ; WA_DragBar,True
- dc.l $80000083,1 ; WA_DepthGadget,True
- dc.l $80000084,1 ; WA_CloseGadget,True
- dc.l $80000089,0 ; WA_Activate,True
- dc.l $80000093,1 ; WA_NewLookMenus,True
- dc.l $8000008D,1 ; WA_SmartRefresh,True
- dc.l $80000090,1 ; WA_AutoAdjust,True
- dc.l $8000006C ; WA_Gadgets
- Win0GList:
- dc.l 0 ; WA_Gadgets
- dc.l $8000007D,Win0ZoomInfo ; WA_Zoom
- dc.l $80000079 ; WA_PubScreen Split over two lines so label is at right place
- Win0Scr: ; (Using default screen)
- dc.l 0
- dc.l 0 ; TAG_END
-
- _AbsExecBase EQU 4
- XDEF _SysBase
- _SysBase DS.L 1
- XDEF _DOSBase
- _DOSBase:
- dc.l 0
- XDEF _GadToolsBase
- _GadToolsBase:
- dc.l 0
- XDEF _GfxBase
- _GfxBase:
- dc.l 0
- XDEF _IntuitionBase
- _IntuitionBase:
- dc.l 0
- XDEF _ReqToolsBase
- _ReqToolsBase:
- dc.l 0
- XDEF _IconBase
- _IconBase:
- dc.l 0
- Icon_Name:
- dc.b 'icon.library',0
- DOS_Name:
- dc.b 'dos.library',0
- GadTools_Name:
- dc.b 'gadtools.library',0
- Gfx_Name:
- dc.b 'graphics.library',0
- Intuition_Name:
- dc.b 'intuition.library',0
- ReqTools_Name:
- dc.b 'reqtools.library',0
- cnop 0,2
-
- XDEF topaz800
-
- topaz800:
- dc.l topaz800FontName
- dc.w 8
- dc.b 0,0
-
- topaz800FontName:
- dc.b 'topaz.font',0
- CNOP 0,2
-
- XDEF MakeMenuNewMenu0
- MakeMenuNewMenu0: ; Parameter of visual info in a0
- movem.l d1-d4/a0-a4/a6,-(sp) ; Store registers
- move.l a0,NewMenu0VI ; Store VisualInfo
- lea NewMenu0NewMenu0,a0 ; New Menu array into a0
- move.l #0,a1 ; Tags for createmenu into a1
- move.l _GadToolsBase,a6 ; Prepare for GadTools call
- jsr _LVOCreateMenusA(a6) ; Call create menu
- move.l d0,NewMenu0 ; Copy result into menu pointer
- tst.l d0 ; See if bad result
- beq NewMenu0CError ; Return error
- move.l NewMenu0,a0 ; Menu into a0
- move.l NewMenu0VI,a1 ; VisualInfo into a1
- lea NewMenu0LT,a2 ; TagList into a2
- move.l _GadToolsBase,a6 ; Prepare for GadTools call
- jsr _LVOLayoutMenusA(a6) ; Call create menu
- tst.l d0 ; See if bad result
- beq NewMenu0LError ; Return error
- moveq #0,d0 ; Set return value of 0
- jmp NewMenu0Done ; Exit succesfully
- NewMenu0CError: ; In case of a create error
- moveq #1,d0 ; Set return value of 1
- jmp NewMenu0Done ; Go to end
- NewMenu0LError: ; In case of a layout error
- moveq #2,d0 ; Set return value of 2
- jmp NewMenu0Done ; Go to end
- move.l NewMenu0,a0 ; Menu into a0
- move.l _GadToolsBase,a6 ; Prepare for GadTools call
- jsr _LVOFreeMenus(a6) ; Free allocated menu
- move.l #0,NewMenu0
- NewMenu0Done: ; Tidy up
- movem.l (sp)+,d1-d4/a0-a4/a6 ; Restore registers
- rts
-
-
- Refresh_Window
- movem.l d0-d4/a0-a4/a6,-(sp) ; Store registers
- move.l Win0,d0
- tst.l d0
- beq .Nope
- movea.l Win0,a0
- movea.l 50(a0),a4
- move.l Win0VisualInfo,BevelTags+12
- move.l Win0VisualInfo,BevelTags2+12
- move.l Win0VisualInfo,BevelTags3+12
- move.l _GadToolsBase(Pc),a6
- move.l #4,d0 ; Bevel height
- move.l d0,d3
- move.l #40,d0 ; Bevel width
- move.l d0,d2
- move.l #4,d0 ; Bevel top
- add.w Win0Offy(Pc),d0
- move.l d0,d1
- move.l #67,d0 ; Bevel bottom
- add.w Win0Offx(Pc),d0
- move.l a4,a0 ; Put RPort in a0
- lea BevelTags(Pc),a1
- jsr _LVODrawBevelBoxA(a6) ; Call DrawBevelBoxA
- move.l #4,d0 ; Bevel height
- move.l d0,d3
- move.l #40,d0 ; Bevel width
- move.l d0,d2
- move.l #15,d0 ; Bevel top
- add.w Win0Offy(Pc),d0
- move.l d0,d1
- move.l #67,d0 ; Bevel bottom
- add.w Win0Offx(Pc),d0
- move.l a4,a0 ; Put RPort in a0
- lea BevelTags2(Pc),a1
- jsr _LVODrawBevelBoxA(a6) ; Call DrawBevelBoxA
- move.l #4,d0 ; Bevel height
- move.l d0,d3
- move.l #40,d0 ; Bevel width
- move.l d0,d2
- move.l #26,d0 ; Bevel top
- add.w Win0Offy(Pc),d0
- move.l d0,d1
- move.l #67,d0 ; Bevel bottom
- add.w Win0Offx,d0
- move.l a4,a0 ; Put RPort in a0
- lea BevelTags3(Pc),a1
- jsr _LVODrawBevelBoxA(a6) ; Call DrawBevelBoxA
- .Nope
- movem.l (sp)+,d0-d4/a0-a4/a6 ; Restore registers
- rts
-
- XDEF OpenWin0Window
- OpenWin0Window:
- move.l #0,a0
- movem.l d1-d4/a0-a6,-(sp)
- move.l a0,Win0MsgPort
- move.l Win0,d0 ; See if window already open, if it is then move it to front etc and exit
- tst.l d0
- bne Win0AlreadyOpen
-
- lea.l PublicName,a0
- cmp.b #0,(a0)
- bne .UsePubl
- sub.l a0,a0
- bra.w .UseWb
- .UsePubl
- move.l #PublicName,a0 ; Sort out screen name pointer
- .UseWb
- CALLINT LockPubScreen
-
- move.l d0,Win0Scr ; Move screen address into tag
- beq NoWin0Scr ; Cannot lock screen
- move.l #116,Win0Width
- move.l #37,Win0Height
- move.l Win0Scr,a0 ; Copy screen into a0
- move.b 36(a0),Win0Offx+1 ; Get left border width in Win_Offx
- move.l 40(a0),a1 ; Put screen font structure address in a1
- move.w 4(a1),d1 ; Put screen font ta_YSize in d1
- addq.w #1,d1 ; Add 1 to d1
- move.b 35(a0),d0 ; Put screen window border top in d0
- ext.w d0 ; Turn d0 into word from byte
- add.w d1,d0 ; Get Offy in d0
- move.w d0,Win0Offy ; Store Win_Offy
- move.l Win0Height,d1 ; Get window height
- add.w d0,d1 ; Add offy
- move.l d1,Win0Height ; Store window height
- move.w Win0Offx,d0
- move.l Win0Width,d1 ; Get window width
- add.w d0,d1 ; Add offx
- move.l d1,Win0Width ; Store window width
- move.l Win0Scr,a0 ; Put Screen in a0
- move.l #0,a1 ; Put NULL in a1
- move.l _GadToolsBase,a6 ; Prepare for GadTools call
- jsr _LVOGetVisualInfoA(a6) ; Get Visual Info
- move.l d0,Win0VisualInfo ; Store Visual Info
- beq CannotGetWin0VisualInfo ; Cannot get VI
- move.l Win0Scr,a0 ; Put Screen in a0
- move.l _IntuitionBase,a6 ; Prepare for Intuition call
- jsr _LVOGetScreenDrawInfo(a6) ; Get Visual Info
- move.l d0,Win0DrawInfo ; Store DrawInfo
- beq CannotGetWin0DrawInfo ; Cannot get DrawInfo
- move.l #0,Win0GList ; Zero GList
- movea.l _GadToolsBase,a6 ; Prepare for GadTools call
- lea Win0GList,a0 ; Put GList in a0
- jsr _LVOCreateContext(a6) ; Create context for gadtools gadget
- movea.l d0,a2 ; Put return value in a2
- tst.l d0 ; See if got NULL return
- beq CannotCreateWin0Context
- ; d3 = current gad a5 = current gad address
- ; a4 = current gad tags a3 = current gad kind
- ; a2 = previous gad
- move.l #0,d3 ; Set to initial value
- lea Win0NGad,a5 ; Set to initial value
- lea Win0GTags,a4 ; Set to initial value
- lea Win0GTypes,a3 ; Set to initial value
- Win0GadgetLoop:
- move.w (a3),d0
- cmp.w #198,d0
- beq Win0SkipOneGadget ; Skip gadget if it is an object
- movea.l _SysBase,a6 ; Prepare for Exec call
- movea.l a5,a0 ; Source in a0
- lea Win0BufNewGad,a1 ; Dest in a1
- moveq #30,d0 ; Size to copy
- jsr _LVOCopyMem(a6) ; Got copy of NewGad
- move.l #0,d0 ; Zero d0
- move.l Win0VisualInfo,Win0BufNewGad+22 ; Visual Info into newgad
- move.w Win0Offx,d0 ; get Offx
- move.w Win0BufNewGad,d1 ; get LeftEdge
- add.w d1,d0 ; Add offset
- move.w d0,Win0BufNewGad ; Store new value
- move.w Win0Offy,d0 ; Get Offy
- move.w 2+Win0BufNewGad,d1 ; Get TopEdge addr
- add.w d1,d0 ; Add offset
- move.w d0,Win0BufNewGad+2 ; Store new value
- move.l #0,d0 ; To make next word operations safe
- movea.l _GadToolsBase,a6 ; Prepare for GadTools call
- movea.l a2,a0 ; Put previous in a0
- move.w (a3),d0
- lea Win0BufNewGad,a1 ; NewGad in a1
- movea.l a4,a2
- jsr _LVOCreateGadgetA(a6) ; Create Gadget
- movea.l d0,a2 ; Store result
- tst.l d0 ; test result
- beq Win0BadGadgets ; Create failed, fail open window
- lea Win0Gadgets,a0 ; Get gadget array address
- move.l d3,d0 ; Get gadget number
- mulu #4,d0 ; Get offset in array
- adda.l d0,a0 ; Get address of position in array
- move.l a2,(a0) ; Store address
- Win0SkipOneGadget: ; Skip gadget if it is an object
- add.w #1,d3 ; Set for next NewGad
- adda #30,a5 ; Move to next NewGad
- adda #2,a3 ; Move to next Gad kind
- jmp Win0NextTag2 ; Get next tag array
- Win0NextTag1: ; Get next tag array
- adda #8,a4 ; Get next tag array
- Win0NextTag2: ; Get next tag array
- move.l (a4),d0 ; Get next tag array
- tst.l d0 ; Get next tag array
- bne Win0NextTag1 ; Get next tag array
- adda #4,a4 ; Get next tag array
- move.w d3,d0 ; Put number of gadget in d0
- sub.w #3,d0
- tst.w d0 ; See if done
- bne Win0GadgetLoop ; If not done repeat
- ; Code to create objects
- ; d3 = current gad a5 = current gad address
- ; a4 = current gad tags a3 = current gad kind
- ; a2 = previous gad
- move.l a2,Win0PrevGadget
- move.l #0,d3 ; Set to initial value
- lea Win0NGad,a5 ; Set to initial value
- lea Win0GTags,a4 ; Set to initial value
- lea Win0GTypes,a3 ; Set to initial value
- Win0ObjectLoop:
- move.w (a3),d0
- cmp.w #198,d0
- bne Win0SkipNotObject ; Skip gadget if it is not an object
- move.l #0,Win0Cla
- movea.l Win0Cla,a0 ; Get Private Class Name in a0
- movea.l 8(a5),a1 ; Get Public Class Name in a1
- movea.l a4,a2 ; Get Tag array
- movea.l _IntuitionBase,a6 ; Prepare for GadTools call
- jsr _LVONewObjectA(a6) ; Create Gadget
- movea.l d0,a2 ; Store result
- lea Win0Gadgets,a0 ; Get gadget array address
- move.l d3,d0 ; Get gadget number
- mulu #4,d0 ; Get offset in array
- adda.l d0,a0 ; Get address of position in array
- move.l a2,(a0) ; Store address
- move.l a2,d0 ; Put address back
- tst.l d0 ; test result
- beq Win0BadGadgets ; Create failed, fail open window
- Win0SkipNotObject: ; Skip gadget if it is not an object
- add.w #1,d3 ; Set for next NewGad
- adda #30,a5 ; Move to next NewGad
- adda #2,a3 ; Move to next Gad kind
- jmp Win0NextTag4 ; Get next tag array
- Win0NextTag3: ; Get next tag array
- adda #8,a4 ; Get next tag array
- Win0NextTag4: ; Get next tag array
- move.l (a4),d0 ; Get next tag array
- tst.l d0 ; Get next tag array
- bne Win0NextTag3 ; Get next tag array
- adda #4,a4 ; Get next tag array
- move.w d3,d0 ; Put number of gadget in d0
- sub.w #3,d0
- tst.w d0 ; See if done
- bne Win0ObjectLoop ; If not done repeat
- move.l #0,a0
- lea Win0Tags,a1
- move.l _IntuitionBase,a6
- jsr _LVOOpenWindowTagList(a6)
- move.l d0,Win0 ; Store result
- tst.l d0
- beq Win0CannotOpenWin ; Fail and tidy up if cannot open window
- move.l Win0,a0
- move.l Win0MsgPort,a1
- move.l a1,86(a0)
- move.l #9028,d0
- move.l _IntuitionBase,a6
- jsr _LVOModifyIDCMP(a6)
- jsr Refresh_Window
- move.l Win0,a1 ; Refresh Window, put win in a0
- move.l Win0GList,a0 ; Refresh Window, put glist in a0
- move.l #0,a2
- move.l #$FFFF,d0
- move.l _IntuitionBase,a6 ; Prepare for Intuition call
- jsr _LVORefreshGList(a6) ; Call RefreshGList
- move.l Win0,a0 ; Refresh Window, put win in a0
- move.l #0,a1 ; Clear a1
- move.l _GadToolsBase,a6 ; Prepare for GadTools call
- jsr _LVOGT_RefreshWindow(a6) ; Call GT_RefreshWindow
- move.l NewMenu0,d0
- tst.l d0
- bne Win0MenuAlreadyOpen
- move.l Win0VisualInfo,a0
- jsr MakeMenuNewMenu0
- Win0MenuAlreadyOpen:
- move.l NewMenu0,d0
- tst.l d0
- beq Win0MenuNotOpen
- move.l Win0,a0
- move.l NewMenu0,a1
- move.l _IntuitionBase,a6
- jsr _LVOSetMenuStrip(a6)
- move.l #0,d0
- jmp UnlockWin0Screen
- Win0MenuNotOpen:
- move.l #0,d0
- jmp UnlockWin0Screen
- Win0AlreadyOpen:
- move.l _IntuitionBase,a6 ; Prepare for intuition call
- move.l Win0,a0 ; Window open so...
- jsr _LVOActivateWindow(a6) ; Activate Window
- jsr _LVOWindowToFront(a6) ; Move window to front
- move.l #0,d0 ; Return OK because window already open
- jmp OpenWin0Done
- Win0CannotOpenWin:
- move.l #1,d0
- jmp FreeWin0Gadgets
- Win0BadGadgets:
- move.l #2,d0
- FreeWin0Gadgets:
- move.l d0,d2
- move.l _GadToolsBase,a6
- move.l Win0GList,a0
- jsr _LVOFreeGadgets(a6)
- move.l d2,d0
- jmp FreeWin0DrawInfo
- CannotCreateWin0Context:
- move.l #4,d0
- FreeWin0DrawInfo:
- move.l d0,d2
- movea.l _IntuitionBase,a6
- movea.l Win0Scr,a0
- movea.l Win0DrawInfo,a1
- jsr _LVOFreeScreenDrawInfo(a6)
- move.l #0,Win0DrawInfo
- move.l d2,d0
- jmp FreeWin0VisualInfo
- CannotGetWin0DrawInfo:
- move.l #128,d0
- FreeWin0VisualInfo:
- move.l d0,d2
- move.l _GadToolsBase,a6
- move.l Win0VisualInfo,a0
- jsr _LVOFreeVisualInfo(a6)
- move.l #0,Win0VisualInfo
- move.l d2,d0
- jmp UnlockWin0Screen
- CannotGetWin0VisualInfo:
- move.l #8,d0
- UnlockWin0Screen:
- move.l d0,d2
- move.l _IntuitionBase,a6
- move.l #0,a0
- move.l Win0Scr,a1
- jsr _LVOUnlockPubScreen(a6)
- move.l #0,Win0Scr
- move.l d2,d0
- jmp OpenWin0Done
- NoWin0Scr: ; Could not lock screen
- move.l #16,d0 ; Set return code of 16
- OpenWin0Done: ; Finish openwindow
- movem.l (sp)+,d1-d4/a0-a6 ; Restore Registers
- rts ; Return
-
- XDEF CloseWin0Window
- CloseWin0Window:
- movem.l d0-d2/a0-a6,-(sp) ; Store Registers
- move.l Win0,d1 ; See if window open
- tst.l d1
- beq Win0NotOpen
- move.l Win0DrawInfo,d1
- tst.l d1
- beq Win0NoSDI
- movea.l Win0,a0
- movea.l 46(a0),a0 ; Get Screen
- movea.l Win0DrawInfo,a1
- move.l _IntuitionBase,a6
- jsr _LVOFreeScreenDrawInfo(a6)
- move.l #0,Win0DrawInfo
- Win0NoSDI:
- move.l Win0,a0 ; ClearMenuStrip
- move.l _IntuitionBase,a6
- jsr _LVOClearMenuStrip(a6)
- move.l NewMenu0,a0
- move.l _GadToolsBase,a6
- jsr _LVOFreeMenus(a6)
- move.l #0,NewMenu0
- move.l Win0,a0
- jsr CloseWindowSafely
- move.l #0,Win0
- Win0NotOpen:
- move.l Win0VisualInfo,d1
- tst.l d1
- beq Win0NoCVI
- move.l d1,a0
- move.l _GadToolsBase,a6
- jsr _LVOFreeVisualInfo(a6)
- move.l #0,Win0VisualInfo
- Win0NoCVI:
- move.l Win0GList,d1
- tst.l d1
- beq Win0NoCGList
- move.l d1,a0
- move.l _GadToolsBase,a6
- jsr _LVOFreeGadgets(a6)
- move.l #0,Win0GList
- Win0NoCGList:
- movea.l _IntuitionBase,a6 ; Prepare for intuition call
- movem.l (sp)+,d0-d2/a0-a6
- rts
-
-
- XDEF OpenLibs
-
- OpenLibs: ; 0 indicates success, 1 failure, no parameters
- movem.l d1/a0-a2/a6,-(sp) ; Store registers
- move.l _AbsExecBase,_SysBase ; Set up Exec Library Base
-
- lea DOS_Name,a1
- moveq #0,d0
- move.l _SysBase,a6
- jsr _LVOOpenLibrary(a6)
- move.l d0,_DOSBase
- beq DOSNotOpened
- lea GadTools_Name,a1 ; Put library name into a1
- moveq #37,d0 ; Put version in d0
- move.l _SysBase,a6 ; Put SysBase in a6 to call Exec function
- jsr _LVOOpenLibrary(a6) ; Call OpenLibrary
- move.l d0,_GadToolsBase ; Put result in library base
- beq Close_Others ; If failed call close of previous open.
-
- lea Gfx_Name,a1 ; Put library name into a1
- moveq #37,d0 ; Put version in d0
- move.l _SysBase,a6 ; Put SysBase in a6 to call Exec function
- jsr _LVOOpenLibrary(a6) ; Call OpenLibrary
- move.l d0,_GfxBase ; Put result in library base
- beq Close_GadTools ; If failed call close of previous open.
-
- lea Icon_Name,a1 ; Put library name into a1
- moveq #37,d0 ; Put version in d0
- move.l _SysBase,a6 ; Put SysBase in a6 to call Exec function
- jsr _LVOOpenLibrary(a6) ; Call OpenLibrary
- move.l d0,_IconBase ; Put result in library base
- beq Close_Gfx ; If failed call close of previous open.
-
- lea Intuition_Name,a1 ; Put library name into a1
- moveq #37,d0 ; Put version in d0
- move.l _SysBase,a6 ; Put SysBase in a6 to call Exec function
- jsr _LVOOpenLibrary(a6) ; Call OpenLibrary
- move.l d0,_IntuitionBase ; Put result in library base
- beq Close_Gfx ; If failed call close of previous open.
-
- lea ReqTools_Name,a1 ; Put library name into a1
- moveq #0,d0 ; Put version in d0
- move.l _SysBase,a6 ; Put SysBase in a6 to call Exec function
- jsr _LVOOpenLibrary(a6) ; Call OpenLibrary
- move.l d0,_ReqToolsBase ; Put result in library base
- beq Close_Intuition ; If failed call close of previous open.
-
- movem.l (sp)+,d1/a0-a2/a6 ; Put registers back
- move.l #0,d0 ; Put 0 in d0 for a succesful return
- rts ; Return from OpenLibs
-
-
- XDEF CloseLibs
-
- CloseLibs: ; No parameters, no return, d0 contents destroyed
- movem.l d1/a0-a2/a6,-(sp) ; Store registers
-
- move.l _ReqToolsBase,a1 ; Put library base in a1
- cmpa.l #0,a1 ; See if open
- beq Close_Intuition ; Skip close if not opened
- move.l _SysBase,a6 ; Put ExecBase in a6 for Exec call
- jsr _LVOCloseLibrary(a6) ; Call Closelibrary
- Close_Intuition:
- move.l _IntuitionBase,a1 ; Put library base in a1
- cmpa.l #0,a1 ; See if open
- beq Close_Gfx ; Skip close if not opened
- move.l _SysBase,a6 ; Put ExecBase in a6 for Exec call
- jsr _LVOCloseLibrary(a6) ; Call Closelibrary
- Close_Icon:
- move.l _IconBase,a1 ; Put library base in a1
- cmpa.l #0,a1 ; See if open
- beq Close_Gfx ; Skip close if not opened
- move.l _SysBase,a6 ; Put ExecBase in a6 for Exec call
- jsr _LVOCloseLibrary(a6) ; Call Closelibrary
- Close_Gfx:
- move.l _GfxBase,a1 ; Put library base in a1
- cmpa.l #0,a1 ; See if open
- beq Close_GadTools ; Skip close if not opened
- move.l _SysBase,a6 ; Put ExecBase in a6 for Exec call
- jsr _LVOCloseLibrary(a6) ; Call Closelibrary
- Close_GadTools:
- move.l _GadToolsBase,a1 ; Put library base in a1
- cmpa.l #0,a1 ; See if open
- beq Close_Others
- move.l _SysBase,a6
- jsr _LVOCloseLibrary(a6)
- Close_Others: ; Close libraries whose opening was not compulsory.
- Close_DOS:
- move.l _DOSBase,a1 ; Put library base in a1
- move.l _SysBase,a6 ; Load SysBase into a6 for Exec call
- jsr _LVOCloseLibrary(a6) ; Call CloseLibrary
- DOSNotOpened:
- movem.l (sp)+,d1/a0-a2/a6 ; Put registers back
- move.l #1,d0 ; Put 1 in d0 so call to OpenLibs gets 1 returned if failed
- ; If called CloseLibs then ignore return
- ; CloseLibs destroys contents of d0
- rts ; Return from CloseLibs
-
-
- StripIntuiMessages:
- movem.l d0/a0-a6,-(sp)
- movea.l a0,a2
- movea.l 86(a0),a0
- movea.l 20(a0),a0
- StripLoop:
- movea.l (a0),a3
- move.l a3,d0
- tst.l d0
- beq EndStrip
- cmpa.l 44(a0),a2
- bne StripSkip
- movea.l a0,a4
- movea.l a0,a1
- movea.l _SysBase,a6
- jsr _LVORemove(a6)
- movea.l a4,a1
- jsr _LVOReplyMsg(a6)
- StripSkip:
- movea.l a3,a0
- jmp StripLoop
- EndStrip:
- movem.l (sp)+,d0/a0-a6
- rts
- XDEF CloseWindowSafely ; Window in a0
-
- CloseWindowSafely:
- movem.l d0/a0/a4/a6,-(sp)
- move.l a0,a4
- move.l _SysBase,a6
- jsr _LVOForbid(a6)
- move.l a4,a0
- jsr StripIntuiMessages
- move.l #0,86(a0)
- move.l _IntuitionBase,a6
- move.l #0,d0
- move.l a4,a0
- jsr _LVOModifyIDCMP(a6)
- move.l _SysBase,a6
- jsr _LVOPermit(a6);
- move.l a4,a0
- move.l _IntuitionBase,a6
- jsr _LVOCloseWindow(a6)
- movem.l (sp)+,d0/a0/a4/a6
- rts
-
-
- NewMenu_Menu0X EQU 0
- NewMenu_Menu0_Item0X EQU 0
- NewMenu_Menu0_Item1X EQU 1
- Win0FirstID EQU 0
-
-